package gui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.HashMap;

import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;

import code.Language;
import code.Settings;

public class OperationHelp extends JPanel{
	ATOCOmain atocoframe;
	String help_type;
	private JLabel jLabel = null;
	private JLabel jLabel1 = null;
	
	private HashMap labels;
	Settings s;

	public OperationHelp(ATOCOmain atocoframe, String help_type){
		s = new Settings();
		Language l = new Language();
		labels = l.changeLanguage((String) s.global.get("language"), "OperationHelp", (String) s.global.get("installPath"));
		this.atocoframe=atocoframe;
		this.help_type=help_type;
		this.setLayout(null);
		this.setBackground(Color.WHITE);
		initialize();
		this.setPreferredSize( new Dimension( 400, 650 ) );
		//this.setMinimumSize( new Dimension( 100, 50 ) );
		//this.setMaximumSize( new Dimension (500, 300));
	}

	public void initialize(){
		if(help_type.equalsIgnoreCase("Enc/Dec")){
//			jLabel = new JLabel("onur");
//			jLabel.setBounds(new Rectangle(30, 20, 335, 25));
//			this.add(jLabel, null);
			ImageIcon encdec = new ImageIcon((String) labels.get("encdec"));
			jLabel1 = new JLabel(encdec);
			if(s.global.get("language").equals("ENG")){
				jLabel1.setBounds(new Rectangle(100, 10, 570, 600));
			}else{
				jLabel1.setBounds(new Rectangle(100, 10, 570, 500));	
			}
			ImageIcon help = new ImageIcon((String) labels.get("help"));
			jLabel = new JLabel(help);
			jLabel.setBounds(new Rectangle(14, 10, 86, 84));
			this.add(jLabel, null);
			this.add(jLabel1, null);
		}else if(help_type.equalsIgnoreCase("Certificate")){
//			jLabel = new JLabel();
//			jLabel.setBounds(new Rectangle(30, 20, 335, 25));
//			jLabel.setText("Certificate");
//			this.add(jLabel, null);
			ImageIcon cert = new ImageIcon((String) labels.get("cert"));
			jLabel1 = new JLabel(cert);
			if(s.global.get("language").equals("ENG")){
				jLabel1.setBounds(new Rectangle(100, 10, 700, 535));
			}else{
				jLabel1.setBounds(new Rectangle(100, 10, 570, 555));	
			}
			ImageIcon help = new ImageIcon((String) labels.get("help"));
			jLabel = new JLabel(help);
			jLabel.setBounds(new Rectangle(14, 10, 86, 84));
			this.add(jLabel, null);
			this.add(jLabel1, null);
		} else if(help_type.equalsIgnoreCase("DigitalSignature")){
//			jLabel = new JLabel();
//			jLabel.setBounds(new Rectangle(30, 20, 335, 25));
//			jLabel.setText("DigitalSignature");
//			this.add(jLabel, null);
			ImageIcon digsig = new ImageIcon((String) labels.get("digsig"));
			jLabel1 = new JLabel(digsig);
			if(s.global.get("language").equals("ENG")){
				jLabel1.setBounds(new Rectangle(100, 30, 570, 600));
			}else{
				jLabel1.setBounds(new Rectangle(100, 10, 570, 555));	
			}
			ImageIcon help = new ImageIcon((String) labels.get("help"));
			jLabel = new JLabel(help);
			jLabel.setBounds(new Rectangle(14, 10, 86, 84));
			this.add(jLabel, null);
			this.add(jLabel1, null);
		} else if(help_type.equalsIgnoreCase("DataIntegrity")){
//			jLabel = new JLabel();
//			jLabel.setBounds(new Rectangle(30, 20, 335, 25));
//			jLabel.setText("DataIntegrity");
//			this.add(jLabel, null);
			ImageIcon mac = new ImageIcon((String) labels.get("mac"));
			jLabel1 = new JLabel(mac);
			if(s.global.get("language").equals("ENG")){
				jLabel1.setBounds(new Rectangle(100, 10, 570, 600));
			}else{
				jLabel1.setBounds(new Rectangle(100, 10, 575, 555));	
			}
			ImageIcon help = new ImageIcon((String) labels.get("help"));
			jLabel = new JLabel(help);
			jLabel.setBounds(new Rectangle(14, 10, 86, 84));
			this.add(jLabel, null);
			this.add(jLabel1, null);
		} else if(help_type.equalsIgnoreCase("KeyStore")){
			ImageIcon key = new ImageIcon((String) labels.get("key"));
			jLabel1 = new JLabel(key);
			if(s.global.get("language").equals("ENG")){
				jLabel1.setBounds(new Rectangle(100, 30, 570, 600));
			}else{
				jLabel1.setBounds(new Rectangle(100, 10, 570, 545));	
			}
			ImageIcon help = new ImageIcon((String) labels.get("help"));
			jLabel = new JLabel(help);
			jLabel.setBounds(new Rectangle(14, 10, 86, 84));
			this.add(jLabel, null);
			this.add(jLabel1, null);
//			jLabel = new JLabel();
//			jLabel.setBounds(new Rectangle(30, 20, 335, 25));
//			jLabel.setText("KeyStore");
//			this.add(jLabel, null);
		} else if(help_type.equalsIgnoreCase("StrongPassword")){
//			jLabel = new JLabel();
//			jLabel.setBounds(new Rectangle(30, 20, 335, 25));
//			jLabel.setText("StrongPassword");
//			this.add(jLabel, null);
			ImageIcon pass = new ImageIcon((String) labels.get("pass"));
			jLabel1 = new JLabel(pass);
			if(s.global.get("language").equals("ENG")){
				jLabel1.setBounds(new Rectangle(100, 10, 570, 550));
			}else{
				jLabel1.setBounds(new Rectangle(100, 10, 570, 480));	
			}
			ImageIcon help = new ImageIcon((String) labels.get("help"));
			jLabel = new JLabel(help);
			jLabel.setBounds(new Rectangle(14, 10, 86, 84));
			this.add(jLabel, null);
			this.add(jLabel1, null);
		} else if(help_type.equalsIgnoreCase("Settings")){
			jLabel = new JLabel();
			jLabel.setBounds(new Rectangle(30, 20, 335, 25));
			jLabel.setText("Settings");
			this.add(jLabel, null);
		}

	}


}
